<!DOCTYPE html>
<html lang="en">
 <head>
  <meta charset="UTF-8" />
  <meta name="author-name" content="Mironcoder | Miron Mahmud" />
  <meta name="author-email" content="mironcoder@gmail.com" />
  <meta name="author-profile" content="https://themeforest.net/user/mironcoder" />
  <meta name="template-name" content="Vegana" />
  <meta name="template-created" content="09-November-2020" />
  <meta name="template-title" content="Vegana - vegan food ecommerce store html template" />
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
  <meta name="keywords" content="vegana, vegan, food, ecommerce, store, html, template, bootstrap, vegetarian, organic, vegetables, greengrocery, fruit, healthy, shop" />
  <title>首页</title>
  <link rel="icon" href="assets/images/logo/favicon.png" />
  <link rel="stylesheet" href="assets/source/css/vendor/flaticon.css" />
  <link rel="stylesheet" href="assets/source/css/vendor/fontawesome.css" />
  <link rel="stylesheet" href="assets/source/css/vendor/slick.css" />
  <link rel="stylesheet" href="assets/source/css/vendor/bootstrap.min.css" />
  <link rel="stylesheet" href="assets/source/css/custom/main.css" />
  <link rel="stylesheet" href="assets/source/css/custom/home-1.css" />
 </head>
 <body>
  <div id="app">
  <header class="header-part">
   <div class="container">
    <div class="row">
     <div class="col-sm-12 col-md-6 col-lg-6">
      <ul class="header-info">
       <li> <i class="fas fa-envelope"></i><p>{{adminEmail}}</p></li>
       <li> <i class="fas fa-phone-alt"></i><p>+{{adminTel}}</p></li>
      </ul>
     </div>
     <div class="col-sm-12 col-md-6 col-lg-6">
      <div class="login_info" v-if="userInfo == ''">
				<a href="./singles/login.html" target="_blank" title="点击登录">您好，请先登录</a>
				<a href="./singles/reg.html" target="_blank" title="点击注册">免费注册</a>
			</div>
			<div class="login_info" v-else>
				<span>尊敬的用户{{userInfo.uname}},您好</span>
				<a href="./singles/login.html" title="点击退出">退出登录</a>
			</div>
     </div>
    </div>
   </div> 
  </header> 
  <!-- 下拉菜单 -->
  <nav class="navbar-part">
    <div class="container">
     <div class="row">
      <div class="col-lg-12">
       <div class="navbar-element">
        <ul class="left-widget">
         <li><a class="icon icon-inline menu-bar" href="#"><i class="fas fa-align-left"></i></a></li>
        </ul> 
        <a class="navbar-logo" href="#"> <img src="assets/images/logo/01.png" alt="logo" /> </a>
        
        <ul class="right-widget">
         <li><a class="icon icon-inline" href="singles/login.html"><i class="fas fa-user"></i></a></li>
         <li><a class="icon icon-inline" href="singles/wishlist.html"><i class="fas fa-heart"></i><sup>{{wishCount}}</sup></a></li>
         <li><a class="icon icon-inline" href="singles/cartlist.html"><i class="fas fa-shopping-cart"></i><sup>{{cartCount}}</sup></a></li>
        </ul>
       </div>
      </div>
     </div>
     <div class="row">
      <div class="col-lg-12">
       <div class="navbar-slide">
        <div class="navbar-content">
         <div class="navbar-slide-cross"> 
          <a class="icon icon-inline cross-btn" href="#"><i class="fas fa-times"></i></a>
         </div>
         <div class="navbar-slide-logo"> 
          <a href="#"><img src="assets/images/logo/01.png" alt="logo" /></a>
         </div>
         <form class="search-form mb-4 navbar-slide-src"> 
          <input type="text" placeholder="Search anything..." /> 
          <button class="btn btn-inline"> <i class="fas fa-search"></i> <span>search</span> </button>
         </form>
         <ul class="navbar-list">
          <li class="navbar-item active"><a class="navbar-link" href="index.html">家</a></li>
          
          <li class="navbar-item navbar-dropdown"> <a class="navbar-link dropdown-indicator" href="#"> <span>店</span> <i class="fas fa-chevron-down"></i> </a>
           <ul class="dropdown-list">
            
            <li><a class="dropdown-link" href="singles/shop-rightbar.html">店铺右侧商品浏览</a></li>
            
           </ul></li>
          <li class="navbar-item navbar-dropdown"> <a class="navbar-link dropdown-indicator" href="#"> <span>页面</span> <i class="fas fa-chevron-down"></i> </a>
           <ul class="dropdown-list">
            <li><a class="dropdown-link" href="singles/cartlist.html">购物清单</a></li>
            <li><a class="dropdown-link" href="singles/wishlist.html">愿望清单</a></li>
            <li><a class="dropdown-link" href="singles/signin-up.html">登录或者注册</a></li>
           </ul></li>
          <li class="navbar-item navbar-dropdown"> <a class="navbar-link dropdown-indicator" href="#"> <span>博客</span> <i class="fas fa-chevron-down"></i> </a>
           <ul class="dropdown-list">
            <li><a class="dropdown-link" href="singles/blog-list.html">博客列表</a></li>
           </ul></li>
          <li class="navbar-item"><a class="navbar-link" href="singles/account.html">账户</a></li>
          <li class="navbar-item"><a class="navbar-link" href="singles/contact.html">联系</a></li>
         </ul>
        </div>
       </div>
      </div>
     </div>
    </div> 
   </nav>
  <div class="btmbar-part">
   <ul class="btmbar-widget">
    <li> <a href="index.html"> <i class="fas fa-home"></i> <span>Home</span> </a></li>
    <li> <a href="singles/wishlist.html" class="wish-icon"> <i class="fas fa-heart"></i> <span>Wishlist</span> <sup>0</sup> </a></li>
    <li> <a href="singles/cartlist.html" class="cart-icon"> <i class="fas fa-shopping-basket"></i> <span>Cart</span> <sup>0</sup> </a></li>
    <li> <a href="singles/account.html"> <i class="fas fa-cog"></i> <span>Settings</span> </a></li>
   </ul>
  </div> 
  <main class="banner-part slider-arrow slider-dots"> 
   <section class="banner-1">
    <div class="container">
     <div class="row">
      <div class="col-md-5 col-lg-6"></div>
      <div class="col-md-7 col-lg-6">
       <div class="banner-content-1">
        <h1>用纯素食物保持健康的生活。</h1>
        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Esse suscipit illum nesciunt, pariatur explicabo nemo!</p> 
        <a class="btn btn-inline" href="singles/shop-leftbar.html"> <i class="fas fa-shopping-basket"></i> <span>立即购买</span> </a>
       </div>
      </div>
     </div>
    </div> 
   </section> 
   <section class="banner-2">
    <div class="container">
     <div class="row">
      <div class="col-lg-12">
       <div class="banner-content-2">
        <h1>Healthy food comes form healthy ingredients.</h1>
        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Esse suscipit illum nesciunt, pariatur explicabo nemo!</p> 
        <a class="btn btn-inline" href="singles/shop-leftbar.html"> <i class="fas fa-shopping-basket"></i> <span>shop now</span> </a>
       </div>
      </div>
     </div>
    </div> 
   </section> 
   <section class="banner-3">
    <div class="container">
     <div class="row">
      <div class="col-md-7 col-lg-6">
       <div class="banner-content-3">
        <h1>Make your food organic and vegan.</h1>
        <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Esse suscipit illum nesciunt, pariatur explicabo nemo!</p> 
        <a class="btn btn-inline" href="singles/shop-leftbar.html"> <i class="fas fa-shopping-basket"></i> <span>shop now</span> </a>
       </div>
      </div>
      <div class="col-md-5 col-lg-6"></div>
     </div>
    </div> 
   </section> 
  </main>  
  <section class="section best-part">
   <div class="container">
    <div class="row">
     <div class="col-lg-12">
      <div class="section-heading">
       <h2 class="title">最畅销产品</h2> 
      </div>
     </div>
    </div>
    <div class="row">
     <div class="col-lg-12">
      <div class="product-slider slider-arrow">

        <div class="product-card">
          <div class="product-img"> 
           <img :src=`../../upload/${item5.pic}` alt="product-1" />
           <ul class="product-widget">
            
            <li><button @click="addAboutWish(item5)"><i class="fas fa-heart"></i></button></li>
            
           </ul>
          </div>
          <div class="product-content">
           <div class="product-name">
            <h6><a :href=`./singles/product-details.html?${item5.pid}`>{{item5.pname}}</a></h6>
           </div>
           <div class="product-price">
            <h6>
             <del>
               ${{((item5.outprice*0.2)+parseFloat(item5.outprice)).toFixed(2)}}
             </del> ${{item5.outprice}}</h6>
            <div class="product-rating"> 
             <i class="fas fa-star"></i> 
             <span>{{item5.pf == null ? 0 : parseFloat(item5.pf).toFixed(1)}}/{{item5.count}}</span>
            </div>
           </div>
           <div class="product-btn"> 
            <a href="javascript:void(0);" @click="addAboutCart(item5)"> <i class="fas fa-shopping-basket"></i> <span>添加购物车</span> </a>
           </div>
          </div>
         </div>
         <div class="product-card">
          <div class="product-img"> 
           <img :src=`../../upload/${item6.pic}` alt="product-2" />
           <ul class="product-widget">
            
            <li><button @click="addAboutWish(item6)"><i class="fas fa-heart"></i></button></li>
            
           </ul>
          </div>
          <div class="product-content">
           <div class="product-name">
             <h6><a :href=`./singles/product-details.html?${item6.pid}`>{{item6.pname}}</a></h6>
           </div>
           <div class="product-price">
            <h6>
             <del>
               ${{((item6.outprice*0.2)+parseFloat(item6.outprice)).toFixed(2)}}
             </del> ${{item6.outprice}}</h6>
            <div class="product-rating"> 
             <i class="fas fa-star"></i> 
             <span>{{item6.pf == null ? 0 : parseFloat(item6.pf).toFixed(1)}}/{{item6.count}}</span>
            </div>
           </div>
           <div class="product-btn"> 
             <a href="javascript:void(0);" @click="addAboutCart(item6)"> <i class="fas fa-shopping-basket"></i> <span>添加购物车</span> </a>
           </div>
          </div>
         </div>
         <div class="product-card">
           <div class="product-img"> 
            <img :src=`../../upload/${item7.pic}` alt="product-2" />
            <ul class="product-widget">
             
             <li><button @click="addAboutWish(item7)"><i class="fas fa-heart"></i></button></li>
             
            </ul>
           </div>
           <div class="product-content">
            <div class="product-name">
              <h6><a :href=`./singles/product-details.html?${item7.pid}`>{{item7.pname}}</a></h6>
            </div>
            <div class="product-price">
             <h6>
              <del>
                ${{((item7.outprice*0.2)+parseFloat(item7.outprice)).toFixed(2)}}
              </del> ${{item7.outprice}}</h6>
             <div class="product-rating"> 
              <i class="fas fa-star"></i> 
              <span>{{item7.pf == null ? 0 : parseFloat(item7.pf).toFixed(1)}}/{{item7.count}}</span>
             </div>
            </div>
            <div class="product-btn"> 
             <a href="javascript:void(0);" @click="addAboutCart(item7)"> <i class="fas fa-shopping-basket"></i> <span>添加购物车</span> </a>
           </div>
           </div>
          </div>
          <div class="product-card">
           <div class="product-img"> 
            <img :src=`../../upload/${item8.pic}` alt="product-2" />
            <ul class="product-widget">
             
             <li><button @click="addAboutWish(item8)"><i class="fas fa-heart"></i></button></li>
             
            </ul>
           </div>
           <div class="product-content">
            <div class="product-name">
              <h6><a :href=`./singles/product-details.html?${item8.pid}`>{{item8.pname}}</a></h6>
            </div>
            <div class="product-price">
             <h6>
              <del>
                ${{((item8.outprice*0.2)+parseFloat(item8.outprice)).toFixed(2)}}
              </del> ${{item8.outprice}}</h6>
             <div class="product-rating"> 
              <i class="fas fa-star"></i> 
              <span>{{item8.pf == null ? 0 : parseFloat(item8.pf).toFixed(1)}}/{{item8.count}}</span>
             </div>
            </div>
            <div class="product-btn"> 
             <a href="javascript:void(0);" @click="addAboutCart(item8)"> <i class="fas fa-shopping-basket"></i> <span>添加购物车</span> </a>
           </div>
           </div>
          </div>
       
       
       
       
       
      </div>
     </div>
    </div>
   </div> 
  </section>
  
  
  <section class="section new-part">
   <div class="container">
    <div class="row">
     <div class="col-lg-12">
      <div class="section-heading">
       <h2 class="title">新产品</h2> 
      </div>
     </div>
    </div>
    <div class="row">
     <div class="col-lg-12">
      <div class="product-slider slider-arrow">

        <div class="product-card">
          <div class="product-img"> 
           <img :src=`../../upload/${item1.pic}` alt="product-1" />
           <ul class="product-widget">
            
            <li><button @click="addAboutWish(item1)"><i class="fas fa-heart"></i></button></li>
            
           </ul>
          </div>
          <div class="product-content">
           <div class="product-name">
            <h6><a :href=`./singles/product-details.html?${item1.pid}`>{{item1.pname}}</a></h6>
           </div>
           <div class="product-price">
            <h6>
             <del>
               ${{((item1.outprice*0.2)+parseFloat(item1.outprice)).toFixed(2)}}
             </del> ${{item1.outprice}}</h6>
            <div class="product-rating"> 
             <i class="fas fa-star"></i> 
             <span>{{item1.pf == null ? 0 : parseFloat(item1.pf).toFixed(1)}}/{{item1.count}}</span>
            </div>
           </div>
           <div class="product-btn"> 
            <a href="javascript:void(0);" @click="addAboutCart(item1)"> <i class="fas fa-shopping-basket"></i> <span>添加购物车</span> </a>
           </div>
          </div>
         </div>
         <div class="product-card">
          <div class="product-img"> 
           <img :src=`../../upload/${item2.pic}` alt="product-2" />
           <ul class="product-widget">
            
            <li><button @click="addAboutWish(item2)"><i class="fas fa-heart"></i></button></li>
            
           </ul>
          </div>
          <div class="product-content">
           <div class="product-name">
             <h6><a :href=`./singles/product-details.html?${item2.pid}`>{{item2.pname}}</a></h6>
           </div>
           <div class="product-price">
            <h6>
             <del>
               ${{((item2.outprice*0.2)+parseFloat(item2.outprice)).toFixed(2)}}
             </del> ${{item2.outprice}}</h6>
            <div class="product-rating"> 
             <i class="fas fa-star"></i> 
             <span>{{item2.pf == null ? 0 : parseFloat(item2.pf).toFixed(1)}}/{{item2.count}}</span>
            </div>
           </div>
           <div class="product-btn"> 
             <a href="javascript:void(0);" @click="addAboutCart(item2)"> <i class="fas fa-shopping-basket"></i> <span>添加购物车</span> </a>
           </div>
          </div>
         </div>
         <div class="product-card">
           <div class="product-img"> 
            <img :src=`../../upload/${item3.pic}` alt="product-2" />
            <ul class="product-widget">
             
             <li><button @click="addAboutWish(item3)"><i class="fas fa-heart"></i></button></li>
             
            </ul>
           </div>
           <div class="product-content">
            <div class="product-name">
              <h6><a :href=`./singles/product-details.html?${item3.pid}`>{{item3.pname}}</a></h6>
            </div>
            <div class="product-price">
             <h6>
              <del>
                ${{((item3.outprice*0.2)+parseFloat(item3.outprice)).toFixed(2)}}
              </del> ${{item3.outprice}}</h6>
             <div class="product-rating"> 
              <i class="fas fa-star"></i> 
              <span>{{item3.pf == null ? 0 : parseFloat(item3.pf).toFixed(1)}}/{{item3.count}}</span>
             </div>
            </div>
            <div class="product-btn"> 
             <a href="javascript:void(0);" @click="addAboutCart(item3)"> <i class="fas fa-shopping-basket"></i> <span>添加购物车</span> </a>
           </div>
           </div>
          </div>
          <div class="product-card">
           <div class="product-img"> 
            <img :src=`../../upload/${item4.pic}` alt="product-2" />
            <ul class="product-widget">
             
             <li><button @click="addAboutWish(item4)"><i class="fas fa-heart"></i></button></li>
             
            </ul>
           </div>
           <div class="product-content">
            <div class="product-name">
              <h6><a :href=`./singles/product-details.html?${item4.pid}`>{{item4.pname}}</a></h6>
            </div>
            <div class="product-price">
             <h6>
              <del>
                ${{((item4.outprice*0.2)+parseFloat(item4.outprice)).toFixed(2)}}
              </del> ${{item4.outprice}}</h6>
             <div class="product-rating"> 
              <i class="fas fa-star"></i> 
              <span>{{item4.pf == null ? 0 : parseFloat(item4.pf).toFixed(1)}}/{{item4.count}}</span>
             </div>
            </div>
            <div class="product-btn"> 
             <a href="javascript:void(0);" @click="addAboutCart(item4)"> <i class="fas fa-shopping-basket"></i> <span>添加购物车</span> </a>
           </div>
           </div>
          </div>
       
      </div>
     </div>
    </div>
   </div> 
  </section> 
  <section class="section blog-part">
   <div class="container">
    <div class="row">
     <div class="col-lg-12">
      <div class="section-heading">
       <h2 class="title">我们的最新博客</h2> 
      </div>
     </div>
    </div>
    <div class="row">
     <div class="col-md-6 col-lg-8">
      <div class="blog-slider slider-arrow">
       <div class="blog-card">
        <div class="blog-img"> 
         <img :src=`../../upload/${item9.pic}` alt="blog-1" />
        </div>
        <div class="blog-content">
         <ul class="blog-meta">
          <li> <i class="far fa-calendar-alt"></i> <span>{{item9.time}}</span></li>
          <li> <i class="far fa-comments"></i> <span>{{item9.count}} 评论数</span></li>
         </ul>
         <div class="blog-text">
          <h3><a :href="'./singles/blog-details.html?' + item9.bid">{{item9.title}}</a></h3>
         </div>
        </div>
       </div>

        <div class="blog-card">
        <div class="blog-img"> 
         <img :src=`../../upload/${item10.pic}` alt="blog-1" />
        </div>
        <div class="blog-content">
         <ul class="blog-meta">
          <li> <i class="far fa-calendar-alt"></i> <span>{{item10.time}}</span></li>
          <li> <i class="far fa-comments"></i> <span>{{item10.count}} 评论数</span></li>
         </ul>
         <div class="blog-text">
          <h3><a :href="'./singles/blog-details.html?' + item10.bid">{{item10.title}}</a></h3>
         </div>
        </div>
       </div>

      </div>
     </div>
     <div class="col-md-6 col-lg-4">
      <div class="side-blog">



       <div class="blog-list" v-for="item in newBlog">
        <div class="blog-list-img"> 
         <img :src=`../../upload/${item.pic}` alt="blog-list-3" />
        </div>
        <div class="blog-list-content">
         <ul class="blog-meta">
          <li> <i class="far fa-calendar-alt"></i> <span>{{item.time}}</span></li>
          <li> <i class="far fa-comments"></i> <span>{{item.count}} 评论数</span></li>
         </ul>
         <div class="blog-text">
          <h3><a :href=`./singles/blog-details.html?${item.bid}`>{{item.title}}</a></h3>
         </div>
        </div>
       </div>
      </div>
     </div>
    </div>
   </div> 
  </section> 
  <section class="feature-part">
   <div class="container">
    <div class="row">
     <div class="col-md-4 col-lg-4">
      <div class="feature-card"> 
       <i class="flaticon-delivery-truck"></i>
       <h3>Free Delivery</h3>
       <p>Tempora odio reiciendis incidunt tenetur deserunt dolores autem beatae</p>
      </div>
     </div>
     <div class="col-md-4 col-lg-4">
      <div class="feature-card"> 
       <i class="flaticon-save-money"></i>
       <h3>Instant Return</h3>
       <p>Tempora odio reiciendis incidunt tenetur deserunt dolores autem beatae</p>
      </div>
     </div>
     <div class="col-md-4 col-lg-4">
      <div class="feature-card"> 
       <i class="flaticon-customer-service"></i>
       <h3>Quick Support</h3>
       <p>Tempora odio reiciendis incidunt tenetur deserunt dolores autem beatae</p>
      </div>
     </div>
    </div>
   </div> 
  </section> 
  <section class="news-part">
   <div class="container">
    <div class="row">
     <div class="col-md-5 col-lg-6">
      <div class="news-content">
       <h2>Subscribe for Latest Offers</h2>
      </div>
     </div>
     <div class="col-md-7 col-lg-6">
      <form class="search-form news-form"> 
       <input type="text" placeholder="Enter Email Address" /> 
       <button class="btn btn-inline"> <i class="fas fa-envelope"></i> <span>Subscribe</span> </button>
      </form>
     </div>
    </div>
   </div> 
  </section> 
  <footer class="footer-part">
   <div class="container">
    <div class="row">
     <div class="col-md-6 col-lg-4">
      <div class="footer-content"> 
       <a href="#"><img src="assets/images/logo/01.png" alt="logo" /></a>
       <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consequatur repudiandae quisquam adipisci asperiores, ipsum ipsa repellat assumenda dolor perspiciatis.</p>
       <ul class="footer-icon">
        <li><a class="icon icon-inline" href="#"><i class="fab fa-facebook-f"></i></a></li>
        <li><a class="icon icon-inline" href="#"><i class="fab fa-twitter"></i></a></li>
        <li><a class="icon icon-inline" href="#"><i class="fab fa-linkedin-in"></i></a></li>
        <li><a class="icon icon-inline" href="#"><i class="fab fa-instagram"></i></a></li>
        <li><a class="icon icon-inline" href="#"><i class="fab fa-pinterest-p"></i></a></li>
       </ul>
      </div>
     </div>
     <div class="col-md-6 col-lg-4">
      <div class="footer-content">
       <h3 class="title">Useful Links</h3>
       <div class="footer-widget">
        <ul>
         <li><a href="#">My Account</a></li>
         <li><a href="#">Order History</a></li>
         <li><a href="#">Order Tracking</a></li>
         <li><a href="#">Best Seller</a></li>
         <li><a href="#">New Arrivals</a></li>
        </ul>
        <ul>
         <li><a href="#">Location</a></li>
         <li><a href="#">Affiliates</a></li>
         <li><a href="#">Contact</a></li>
         <li><a href="#">Carrer</a></li>
         <li><a href="#">Faq</a></li>
        </ul>
       </div>
      </div>
     </div>
     <div class="col-md-12 col-lg-4">
      <div class="footer-content">
       <h3 class="title">Download the App</h3>
       <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Fugit dicta amet tenetur soluta blanditiis at optio molestias facilis praesentium eos! Sed placeat a labore corporis aliquam reiciendis eaque quisquam corrupti.</p>
      </div>
      <ul class="download-app">
       <li><a href="#"><img src="assets/images/logo/google.png" alt="google" /></a></li>
       <li><a href="#"><img src="assets/images/logo/app.png" alt="app" /></a></li>
      </ul>
     </div>
    </div>
   </div> 
  </footer>
  <div class="footer-bottom">
   <div class="container">
    <p>Copyright &copy; 2020 | All rights reserved by <a target="_blank" href="https://themeforest.net/user/mironcoder">Mironcoder</a></p>
    <ul class="pay-card">
     <li><a href="#"><img src="assets/images/pay-card/01.jpg" alt="payment-1" /></a></li>
     <li><a href="#"><img src="assets/images/pay-card/02.jpg" alt="payment-2" /></a></li>
     <li><a href="#"><img src="assets/images/pay-card/03.jpg" alt="payment-3" /></a></li>
     <li><a href="#"><img src="assets/images/pay-card/04.jpg" alt="payment-4" /></a></li>
    </ul>
   </div>
  </div>
  </div>
  <script src="./js/vue.js"></script>
  <script src="./js/axios.js"></script>
  <script src="./js/qs.js"></script> 
  <script src="assets/source/js/vendor/jquery-1.12.4.min.js"></script> 
  <script src="assets/source/js/vendor/popper.min.js"></script> 
  <script src="assets/source/js/vendor/bootstrap.min.js"></script> 
  <script src="assets/source/js/vendor/slick.min.js"></script> 
  <script src="assets/source/js/custom/slick.js"></script> 
  <script src="assets/source/js/custom/main.js"></script>
  <script>
    let app = new Vue({
      el: '#app',
      data: {
        uname:'',
        uid:'',
        userInfo:{},//用户信息
        types:[],//上架的类别
        adminEmail:'',
        adminTel:'',
        cartCount:0,//购物车数量
        wishCount:0,//心愿单数量///
        hotproduct:[],//热门产品
        newproduct:[],//新品
        buyproduct:[],//畅销产品
        item1:{},
        item2:{},
        item3:{},
        item4:{},
        item5:{},
        item6:{},
        item7:{},
        item8:{},
        item9:{},
        item10:{},
        newBlog:[]
      },
      methods:{
        findUserInfo(){//查询用户信息
            let uid = localStorage.getItem("uid");
            if(uid == null || uid == ""){
                  alert("请先登录");
                  location.href="./singles/login.html";
					        return;
				    }else{
              this.uid = localStorage.getItem("uid");
            }
            axios.get("userController/findUserInfo").then(resp=>{
                if(resp.data == -1){
                  alert("请先登录");
                  location.href="./singles/login.html";
                  return;
                }else{
                  this.userInfo = resp.data;
                  console.log(resp.data);
                }
              }); 
          },
        findAdminInfo(){//查询管理员信息
          axios.get("userController/findAdminInfo").then(resp=>{
            localStorage.setItem("adminEmail",resp.data.email);
            localStorage.setItem("adminTel",resp.data.tel);
            this.adminEmail = resp.data.email;
            this.adminTel = resp.data.tel;
          });
        },
        findTypes(){//查询类别
          axios.get("typeController/findTypes").then(resp=>{
            this.types = resp.data;
          });
        },
        getCartCount(){//得到购物车数量
            if(this.userInfo == null){
              return;
            }
            let count = localStorage.getItem("cartCount");
            if(count == null || count == ""){
              axios.get("carInfoController/getCartCount",{
                params:{
                  uid:this.uid
                }
                }).then(resp=>{
                this.cartCount = resp.data;
                //存值
                localStorage.setItem("cartCount",this.cartCount);
              });
            }else{
              this.cartCount = count;
            }		
			    },
          getWishCount(){//得到心愿单数量
            if(this.userInfo == null){
              return;
            }
            let count = localStorage.getItem("wishCount");
            if(count == null || count == ""){
              axios.get("wishController/getWishCount",{
                params:{
                  uid:this.uid
                }
                }).then(resp=>{
                this.wishCount = resp.data;
                //存值
                localStorage.setItem("wishCount",this.wishCount);
              });
            }else{
              this.wishCount = count;
            }		
			    },
          getnewproduct(){
            if(this.userInfo == null){
              return;
            }
            axios.get("productController/getnewproduct").then(resp=>{
              this.newproduct = resp.data;
              if(Array.isArray(this.newproduct)){
                  this.newproduct.forEach((item,index) => {
                  if(index == 0){
                    this.item1 = item;
                  }else if(index == 1){
                    this.item2 = item;
                  }else if(index == 2){
                    this.item3 = item;
                  }else if(index == 3){
                    this.item4 = item;
                  }
                });
                }
              console.log(this.newproduct);
            });
          },
          getbuyproduct(){
            if(this.userInfo == null){
              return;
            }
            axios.get("productController/getbuyproduct").then(resp=>{
              this.buyproduct = resp.data;
              if(Array.isArray(this.buyproduct)){
                  this.buyproduct.forEach((item,index) => {
                  if(index == 0){
                    this.item5 = item;
                  }else if(index == 1){
                    this.item6 = item;
                  }else if(index == 2){
                    this.item7 = item;
                  }else if(index == 3){
                    this.item8 = item;
                  }
                });
                }
              console.log(this.buyproduct);
            });
          },
          addAboutCart(obj){
            axios.get("carInfoController/addCart",{
              params:{
                uid:this.uid,
                pid:obj.pid,
                num:1,
                inventory:obj.inventory
              }
            }).then(resp=>{
                if(resp.data != -1 && resp.data != 3){
                  alert("添加购物车成功");
                  //重新存值
                  if(resp.data == 2){
                    localStorage.setItem("cartCount",parseInt(this.cartCount) + 1);
                  }
                  this.getCartCount();
                }else if(resp.data == 3){
                    alert("库存不足");
                    return;
                }else{
                  alert("添加购物车失败");
                  return;
                }
            });
          },
          addAboutWish(obj){
            axios.get("wishController/addWish",{
              params:{
                uid:this.uid,
                pid:obj.pid,
                price:obj.outprice,
                num:1,
                inventory:obj.inventory
              }
            }).then(resp=>{
                if(resp.data != -1 && resp.data != 3){
                  alert("添加心愿单成功");
                  //重新存值
                  if(resp.data == 2){
                    localStorage.setItem("wishCount",parseInt(this.wishCount) + 1);
                  }
                  this.getWishCount();
                }else if(resp.data == 3){
                    alert("库存不足");
                    return;
                }else{
                  alert("添加心愿单失败");
                  return;
                }
            });
          },
          newBlogF() {  
            axios.get("blogController/newBlog").then(resp => {  
              if (Array.isArray(resp.data) && resp.data.length >= 3) {  
                // 保留原始数据（如果需要的话）  
                // this.newBlog = resp.data; // 这行可以根据你的需求决定是否保留  
            
                // 截取后三个数据  
                const lastThreeBlogs = resp.data.slice(-3);  
                console.log(lastThreeBlogs); // 打印后三个博客  
            
                // 如果你确实想要更新newBlog以只包含后三个数据  
                this.newBlog = lastThreeBlogs;  
            
                // 额外处理前两个元素（如果需要的话）  
                if (resp.data.length >= 1) {  
                  this.item9 = resp.data[0];
                  console.log(this.item9);  
                }  
                if (resp.data.length >= 2) {  
                  this.item10 = resp.data[1]; 
                  console.log(this.item10); 
                }  
            
                // 注意：这里不再打印原始的resp.data，因为它可能包含多于后三个的数据  
              } else {  
                console.log("数组长度不足3，或者数据不是数组");  
              }  
            }).catch(error => {  
              console.error('获取新博客时发生错误:', error);  
            });  
          }
      },
      created(){
         this.findUserInfo();
         this.findAdminInfo();
         this.findTypes();
         this.getCartCount();
         this.getWishCount();
         this.getnewproduct();
         this.getbuyproduct();
         this.newBlogF();
        
      },
      mounted(){
        // let username = localStorage.getItem("username");
				//     if(username == null || username == ""){
				// 	    return;
				//     }
        //     this.uname = username;
      }
    });
  </script> 
 </body>
</html>